package singleton;

import java.io.*;

/**
 * todo
 *
 * @author: luolidong
 * @create: 2021-07-15 11:46
 * @version: 1.0
 */
public class BreakSingleton {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
//        FileOutputStream fos = new FileOutputStream("./design_patterns/src/singleton/singleton.data");
//        ObjectOutputStream oos = new ObjectOutputStream(fos);
        Singleton2 instance = Singleton2.getInstance();
////        EnumTest instance = EnumTest.ADD_SUCCESS;
//        oos.writeObject(instance);

        FileInputStream fis = new FileInputStream("singleton.data");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Object object =  ois.readObject();

        System.out.println(object==instance);

    }
}
